#ifndef HTTPTRANSPORT_H
#define HTTPTRANSPORT_H

#ifdef WX_PRECOMP
#include "wx/wx.h"
#endif

#include <map>
#include <vector>

#include <map>

#include <wx/string.h>
#include <wx/tokenzr.h>

#include "tux.h"

#include "MsnTransport.h"

class HTTPTransport : public MsnTransport
{
private:
	wxString gatewayIP;
	wxString sessionID;

	//indicate the transport is just open
	bool openAction;

public:
	HTTPTransport();
    virtual ~HTTPTransport(){}

public:
    virtual void* Entry();

	virtual void SendData(void* data, unsigned int size);
	
public:
	void HttpPost(const wxString& url, const wxString& body);

	wxString ReadHeader();

protected:
	void ProcessHttpBody(char* buf, int len);

	wxString GetSessionID(const wxString& headers);
	wxString GetGatewayIP(const wxString& headers);
	int GetContentLength(const wxString& headers);

};

#endif
